// 获取URL地址参数
function getQueryString(name, url) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    if (!url || url == ""){
        url = window.location.search;
    }else{
        url = url.substring(url.indexOf("?"));
    }
    r = url.substr(1).match(reg);
    if (r != null) return unescape(r[2]); return null;
}
function getUrlParams(name) {
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if(r!=null)return  unescape(r[2]); return null;
}

/*文件上传*/
var fileuploader = {
     uploader : function () {
         $("#uploader").on("change","input[type='file']",function(){
             var filePath=$(this).val();
             console.log(filePath);
             if(filePath.indexOf("xlsx")!=-1 || filePath.indexOf("csv")!=-1){
                 $(".fileerrorTip").html("").hide();
                 var arr=filePath.split('\\');
                 var fileName=arr[arr.length-1];
                 $(".showFileName").html(fileName);
                 $(".lable-name").hide()
             }else{
                 $(".showFileName").html("");
                 $(".fileerrorTip").html("上传文件类型有误！").show();
                 return false
             }
         })
     }
};

/*右边栏*/
var rightbar = {
    mask : $('<div></div>'),
    open : function () {
        $("#right-sidebar").addClass("sidebar-open");
    },
    close:function () {
        $("#right-sidebar").removeClass("sidebar-open");
    },
    fadein : function () {
        this.open();
        this.mask.addClass("modal-backdrop fade in");
        $(document.body).append(this.mask);
        var that = this;
        this.mask.bind("click",function(){
            that.fadeout();
        });
    },
    fadeout:function () {
        this.mask.remove();
        this.close();
    }
};
